<?php namespace Home\Controller;
use Hdphp\Controller\Controller;

class ContentController extends Controller{
	public function index(){
		$arcModel=new \Common\Model\Arc;
		//获取当前文章对应的所有的文章
		$aid=Q('get.aid',0,'intval');
		$arcData=$arcModel->join('article_data','aid','=','article_aid')->where("aid=$aid")->get();
		//给文章表加上标签
		$arcTagModel=new \Common\Model\ArcTag;
		foreach($arcData as $a=>$b){
			$arcData[$a]['tag']=$arcTagModel->join('tag','tag_tid','=','tid')->where("article_aid={$aid}")->get();
		}
		//点击次数加1
		$arcModel->where("aid={$aid}")->increment('click',1);
//		p($arcData);
		View::with('arcdata',$arcData);
	    View::make();
	}
}